<?php 
session_start();

if(!isset($_SESSION['username']))
{
	header("Location: index.php");
	exit();
} 

require("../db/opendb.php");
require("common/functions.php");

$query = "select * from Users where Username='".$_SESSION["username"]."'";
$result = mysql_query($query) or die ("SQL Error".mysql_error());
$row=mysql_fetch_assoc($result);

$agent = ($_POST['agent']) ? 1 : 0;

$sql = "update Users set First_Name = '".$_POST['firstname']."', Home_Search_URL = '".$_POST['home_search']."', Last_Name = '".$_POST['lastname']."', Phone = '".$_POST['phone']."',Email = '".$_POST['email']."',Street = '".$_POST['street']."',City = '".$_POST['city']."',State = '".$_POST['state']."',Zip = '".$_POST['zip']."',Website = '".$_POST['website']."',License_Number = '".$_POST['license']."',Brokerage = '".$_POST['broker']."',Website = '".$_POST['website']."', Agent = '".$agent."' where ID = '".$_SESSION['id']."'";

//$sql = "update Users set First_Name = '".$_POST['firstname']."', Last_Name = '".$_POST['lastname']."' where ID = '".$_SESSION['id']."'";


$result = mysql_query($sql) or die ("SQL Error".mysql_error());

require("../db/closedb.php");
echo "<meta http-equiv=refresh content=0;URL=edit_user.php>";



?>